package link.anyauto.j2m;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.TextView;

import butterknife.Bind;
import butterknife.ButterKnife;
import link.anyauto.j2m.multithread.MultiThreadDemo;

/**
 * Created by LYQ on 2016/5/11.
 */
public class MultiThreadAct extends Activity {
    @Bind(R.id.tv_result)
    TextView tvResult;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.act_multi_thread);
        ButterKnife.bind(this);
        tvResult.setText("正在执行耗时操作中 ... ... ");
        handler = new Handler() {
            @Override
            public void handleMessage(Message msg) {
                switch (msg.what) {
                    case MSG_LOG:
                        tvResult.append("\n" + msg.obj);
                        break;
                }
            }
        };
        new MultiThreadDemo(handler).start();
    }

    public static final int MSG_LOG = 1;
    Handler handler;
}
